﻿using System;
using System.Net;
using System.Runtime.Serialization;

namespace Airport
{
    [DataContract]
    public class PlaneType
    {

        private int _planeTypeId;
        private string _typeName;
        private int _maxWeight;
        private int _length;
        private int _wingspan;

        public PlaneType()
            : this(-1, "", -1, -1, -1)
        { 
        }

        public PlaneType(int planeTypeId, string typeName, int maxWeight, int length, int wingspan)
        {
            _planeTypeId = planeTypeId;
            _typeName = typeName;
            _maxWeight = maxWeight;
            _length = length;
            _wingspan = wingspan;
        }

        [DataMember]
        public int PlaneTypeId
        {
            get
            {
                return _planeTypeId;
            }

            set
            {
                if (_planeTypeId != value)
                {
                    _planeTypeId = value;
                }
            }
        }

        [DataMember]
        public string TypeName
        {
            get
            {
                return _typeName;
            }

            set
            {
                if (_typeName != value)
                {
                    _typeName = value;
                }
            }
        }

        [DataMember]
        public int MaxWeight
        {
            get
            {
                return _maxWeight;
            }

            set
            {
                if (_maxWeight != value)
                {
                    _maxWeight = value;
                }
            }
        }

        [DataMember]
        public int Length
        {
            get
            {
                return _length;
            }

            set
            {
                if (_length != value)
                {
                    _length = value;
                }
            }
        }

        [DataMember]
        public int Wingspan
        {
            get
            {
                return _wingspan;
            }

            set
            {
                if (_wingspan != value)
                {
                    _wingspan = value;
                }
            }
        }

        public bool Equals(PlaneType other)
        {
            // TODO This should probably check against more than just TypeName
            return _typeName.Equals(other._typeName);
        }
    }
}
